package color

import "fmt"

const (
	Reset = iota
)

//字体颜色
const (
	Black = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

//高亮颜色
const (
	HiBlack = iota + 90
	HiRed
	HiGreen
	HiYellow
	HiBlue
	HiMagenta
	HiCyan
	HiWhite
)
//背景色
const (
	BgBlack = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)
//背景高亮色
const (
	BgHiBlack = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)


func ColorStr(color int, format string, args ...interface{}) string {
	str := fmt.Sprintf(format, args...)
	return fmt.Sprintf("\x1b[0;%dm", color) + str + "\x1b[0m"
}

func Color(color int,str string) string {
	return fmt.Sprintf("\x1b[0;%dm", color) + str + "\x1b[0m"
}

func B(color int) string {
	return fmt.Sprintf("\x1b[0;%dm", color)
}

func E() string {
	return "\x1b[0m"
}
